//禁止右键
$("body").on("contextmenu", function() {
    return false;
});
//禁止文本选择
$("body").on("selectstart", function() {
    return false;
});

//选中图片颜色变亮，其余变暗
$(".panel-menu img").click(function () {
    var element = $(this);
    $(".panel-menu img").each(function (index) {
        if ($(this).is(element)) {
            $(this).attr("src", "/img/menu0" + index + ".png");
            $(".title-wrap").text($(this).attr("title"));
        } else {
            $(this).attr("src", "/img/menu1" + index + ".png");
        }
    });
});

$("#file-upload").fileinput({
    language: 'zh',
    uploadUrl: "/upload",
    autoReplace: true,
    showUpload: true, //是否显示上传按钮
    showCaption: false, //是否显示标题
    uploadAsync: true,
    browseOnZoneClick: true,
    showBrowse: false, //是否显示选择按钮
    maxFileCount: 1,
    maxFileSize: 50000,
    allowedFileExtensions: ["apk"],
    browseClass: "btn btn-primary", //按钮样式
    previewFileIcon: "<i class='glyphicon glyphicon-king'></i>"
}).on("fileuploaded", function (e, data) {
    var res = data.response;
    if (res.status != 1) {
        alert('上传失败');
    }
});

$("#testConnect").click(function () {
    $.get("/selectAndroid", function (data, textStatus) {
        if (data) {
            $("#result img").attr("src", "/img/screen.png?t=" + Math.random());
        } else {
            alert("连接失败！");
        }
    });
});

$("#messages a").click(function () {
    $.get("/start", function (data, textStatus) {
        console.log(data);
        $("#messages a").text(data);
    });
});
